define(function(require, exports, module) {
	'use strict';
    
    var rk = require('rk');

    return {
        init: function(){
        	 var html = require('page/tmpl/score/index.tpl');
             $('#rk-panel').html(rk.templateText(html,{SESSION:SESSION}));
             rk.showPageView('rk-panel', rk.i18n('SCORE_INTEGRAL_RULE'));
            var elem = $('#rk-panel');
            elem.find(".integral-table-content").beScroll();
            var isXsyCrmAdmin = SESSION.isXsyCrmAdmin;
            if(isXsyCrmAdmin){
                elem.find("[act='export_scort_table_div']").show();
            }else{
                elem.find("[act='export_scort_table_div']").hide();
            }
            elem.on("click", "[act='export_score_table']", function(){
                rk.dialog({
                    title: rk.i18n('SCORE_EXPORT'),
                    success: function (contentElem,footerElem) {
                        //contentElem.find("[act='ok']");
                        require.async(["page/tmpl/score/export.tpl"],function(temp){
                            contentElem.html(rk.templateText(temp));
                            //rk.oa.get
                            footerElem.on("click", "[act='ok']", function(){
                                var form = contentElem.find("[act='score_export_form']");
                                form.submit();
                            });
                        });
                    },
                    footer: [{
                        act: 'ok', visible: true, text: rk.i18n('SCORE_EXPORT')
                    }]
                });
            });
        }
    }

});
